package com.cyh.testdesignpattern.factory.simplefactory;

//修改了店铺和原料只需要改工厂类就可以了。
public class SimpleFactory {
    public Pizza createPizza(String orderType) {
        Pizza pizza = null;
        if(orderType.equals("gree")) {
            pizza = new GreePizza();
            pizza.setName("希腊披萨");
        } else if(orderType.equals("cheese")) {
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }
        return pizza;
    }

    public static Pizza createPizza2(String orderType) {
        Pizza pizza = null;
        if(orderType.equals("gree")) {
            pizza = new GreePizza();
            pizza.setName("希腊披萨");
        } else if(orderType.equals("cheese")) {
            pizza = new CheesePizza();
            pizza.setName("奶酪披萨");
        }
        return pizza;
    }
}
